﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Activities;

namespace WFBot.Workflow.Activities
{
    public class PushCommand : NativeActivity
    {
        public InArgument<string> Channel { get; set; }
        public InArgument<string> Command { get; set; }
        public InArgument<object> Parameter { get; set; }

        protected override void Execute(NativeActivityContext context)
        {
            var wfService = context.GetExtension<IWorkflowService>();
            wfService.Push(new Message
            {
                Channel = Channel.Get(context),
                Sender = "WFBot",
                Type = MessageType.Command,
                Origin = MessageOrigin.Server,
                Body = string.Empty,
                Command = Command.Get(context),
                Parameter = Parameter.Get(context)
            });
        }
    }
}